//
//  EmailValidatorTests.swift
//  User
//
//  Created by ET|冰琳 on 2017/1/9.
//  Copyright © 2017年 IB. All rights reserved.
//

import XCTest
@testable import User

class EmailValidatorTests: XCTestCase {
    
    var validator = EmailValidator()
    
    override func setUp() {
        super.setUp()
        // Put setup code here. This method is called before the invocation of each test method in the class.
    }
    
    override func tearDown() {
        // Put teardown code here. This method is called after the invocation of each test method in the class.
        super.tearDown()
    }
    
    func testQQExample() {
        let qq = "123456@qq.com"
        let valide = validator.validate(txt: qq)
        XCTAssert(valide == true, "qq号码合法")
    }
    
    func testCharactorEmail()  {
        let email = "anrenzhengqin@163.com"
        let valide = validator.validate(txt: email)
        XCTAssert(valide == true, "邮箱合法")
    }
    
    func testDot() {
        let email = "bing.lin@aaa.com"
        let valide = validator.validate(txt: email)
        XCTAssert(valide == true, "邮箱合法")
    }
    
    func testcenterLIne() {
        let email = "bing-lin@aaa.com"
        let valide = validator.validate(txt: email)
        XCTAssert(valide == true, "邮箱合法")
    }
    
    func testBottomLine() {
        let email = "bing.lin@aaa.com"
        let valide = validator.validate(txt: email)
        XCTAssert(valide == true, "邮箱合法")
    }
    
    func testBlank() {
        let email = " binglin@aaa.com"
        let valide = validator.validate(txt: email)
        XCTAssert(valide == false, "邮箱不合法 有空格")
    }
    
    func testCharactorWithNumber() {
        let email = "binglin001@163.com"
        let valide = validator.validate(txt: email)
        XCTAssert(valide == true, "邮箱不合法 有空格")
    }
}
